package com.cjhedu.web.config;

import com.cjhedu.web.interpector.MyInteceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 陈佳豪
 * @version 1.0
 * 自定义拦截器的配置类
 */
@Component
public class MyConfig implements WebMvcConfigurer {
    @Autowired
    private MyInteceptor myInteceptor;
    //注册之定义拦截器的方法
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInteceptor).addPathPatterns("/**")
                .excludePathPatterns("/login");///**任意路径 任意层级
    }
}
